﻿<UserControl x:Class="Peter.View.ViewOptionsGeneral"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="clr-namespace:Peter.Common.Controls;assembly=Peter.Common"
             xmlns:data="clr-namespace:Peter.Data"
             xmlns:properties="clr-namespace:Peter.Properties"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300"
             d:DataContext="{d:DesignInstance data:OptionsGeneral}">

   <UserControl.Resources>
      <BooleanToVisibilityConverter x:Key="BoolToVisi" />
   </UserControl.Resources>

   <Grid>

      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      
      <GroupBox Header="Save/Load Layout"
                Grid.Row="0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            <RadioButton Content="Save layout on exit and load on startup"
                         IsChecked="{Binding Path=SaveLayoutOnExit, Mode=TwoWay, Source={x:Static properties:Settings.Default}}"
                         Grid.Row="0" />
            <RadioButton Content="Startup with a blank document"
                         IsChecked="{Binding Path=StartupBlankDoc, Mode=TwoWay, Source={x:Static properties:Settings.Default}}"
                         Grid.Row="1" />
            <RadioButton Content="Open specific documents on startup:"
                         IsChecked="{Binding Path=StartupSpecificDocs, Mode=TwoWay, Source={x:Static properties:Settings.Default}}"
                         x:Name="RbOpenSpecificDocs"
                         Grid.Row="2" />
            
            <Grid Grid.Row="3"
                  Visibility="{Binding ElementName=RbOpenSpecificDocs, Path=IsChecked, Converter={StaticResource BoolToVisi}}">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="325px"/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               
               <ListBox Height="75"
                        Grid.Column="0"
                        SelectionMode="Single"
                        SelectedItem="{Binding Path=SelectedOpenItem}"
                        ItemsSource="{Binding Path=StartupFiles}"/>
               
               <StackPanel Orientation="Vertical"
                           VerticalAlignment="Top"
                           Grid.Column="1">
                  <controls:StateButton ToolTip="Add.."
                                        Icon="Plus"
                                        FontSize="8"
                                        State="Success"
                                        Command="{Binding Path=AddOpenDocCommand}" />
                  <controls:StateButton ToolTip="Remove"
                                        Icon="Minus"
                                        FontSize="8"
                                        State="Fail"
                                        Command="{Binding Path=RemoveOpenDocCommand}" />
               </StackPanel>
            </Grid>
         </Grid>
      </GroupBox>
      
      <GroupBox Header="History"
                Grid.Row="1">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="150px" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="Max Search History"
                       VerticalAlignment="Center"
                       Grid.Row="0"
                       Grid.Column="0" />

            <controls:NumericUpDown Value="{Binding Path=MaxSearchHistory, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Source={x:Static properties:Settings.Default}}"
                                    HorizontalAlignment="Left"
                                    Precision="0"
                                    Margin="0,0,0,3"
                                    Grid.Column="1"
                                    Grid.Row="0" />

            <TextBlock Text="Max Command History"
                       VerticalAlignment="Center"
                       Grid.Row="1"
                       Grid.Column="0" />

            <controls:NumericUpDown Value="{Binding Path=MaxCommandHistory, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Source={x:Static properties:Settings.Default}}"
                                    HorizontalAlignment="Left"
                                    Precision="0"
                                    Margin="0,0,0,3"
                                    Grid.Column="1"
                                    Grid.Row="1" />
         </Grid>
      </GroupBox>

      <!--<GroupBox Header="Theme"
                Grid.Row="2">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            
            <ComboBox Grid.Row="0"
                      ItemsSource="{Binding Path=Themes}"
                      SelectedItem="{Binding Path=SelectedTheme}"/>
         </Grid>
      </GroupBox>-->

   </Grid>
</UserControl>
